package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 文件复制(块读写)
 */
public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("Car.jpg");
        FileOutputStream fos = new FileOutputStream("Car_c3.jpg");
        long star = System.currentTimeMillis();
        int len;
        byte[] b = new byte[1024 * 10];
        while ((len = fis.read(b)) != -1) {
            //fos.write(b);
            fos.write(b, 0, len);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制所需时间" + (end - star));
        fis.close();
        fos.close();
    }
}
